package io.mvvm.common.constant;

/**
 * @program: seize-login
 * @description: 常量
 * @author: 潘
 * @create: 2021-05-15 03:33
 **/
public final class SystemConstants {

    private SystemConstants() {
    }

    private static final String SYSTEM = "SYSTEM:";

    private static final String LOGIN = "LOGIN";

    private static final String STATUS = "STATUS";

    private static final String BACK = "BACK";
    /**
     * 在线用户 Token 存放
     */
    public static final String LOGIN_STATUS = create(LOGIN, STATUS);
    /**
     * 强制登陆暂存token的key
     */
    public static final String LOGIN_STATUS_BACK = create(LOGIN, STATUS, BACK);


    public static String create(String... constants) {
        StringBuilder sb = new StringBuilder(SYSTEM);
        for (int i = 0; i < constants.length; i++) {
            sb.append(constants[i]).append(":");
        }
        return sb.toString();
    }

    public static String append(String... constants) {
        StringBuilder sb = new StringBuilder(constants[0]);
        for (int i = 1; i < constants.length; i++) {
            sb.append(constants[i]).append(":");
        }
        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }



}
